$(function(){
    var user=JSON.parse(localStorage.getItem("admin"));
})
function sj(){
    var aa=document.getElementById("osj").value;
    var name=document.getElementById("shr").value;
    var dizhi=document.getElementById("xxdz").value;
    var ss=/^1\d{10}$/;
    var sss=ss.test(aa);
    var h=0;
    if(sss){
        var aas=document.getElementById("yq").innerHTML=" ";
    }else{
        var s=document.getElementById("yq").innerHTML="手机号格式错误";
        h++;
    }
    if(dizhi.length>0){
        var aas=document.getElementById("dizhi").innerHTML=" ";
    }else{
        var s=document.getElementById("dizhi").innerHTML="地址不能为空";
        h++;
    }
    if(name.length>0){
        var aas=document.getElementById("name").innerHTML=" ";
    }else{
        var s=document.getElementById("name").innerHTML="姓名不能为空";
        h++;
    }
    if(h!=0){
        return false 
    }else{
        return true;
    }
}
function lj(){
        if(sj()){
            var aa=document.getElementById("osj").value;
            var ss=/^1\d{10}$/;
            var sss=ss.test(aa);
            if(sss){
                var q=document.getElementById("osj").value;
                var name=document.getElementById("shr").value;
                var dizhi=document.getElementById("xxdz").value;
                var obj={name:name,phone:q,dizhi:dizhi};
                var user=JSON.parse(localStorage.getItem("admin"));
                var e=user[0].gwc.length-1;
                user[0].gwc[e].shouhuo.push(obj);
				localStorage.setItem("admin",JSON.stringify(user));
                window.location="收银台.html";
            }else{
                
            }
        }
    }
function zx(){
    var zx=document.getElementById("zx");
    var hd=document.getElementById("hd");
    zx.style.border="1px solid red";
    hd.style.color="black";
    zx.style.color="red";
    hd.style.border="1px solid #dbdbdb";
}
function xz(){
    var zx=document.getElementById("zx");
    var hd=document.getElementById("hd");
    zx.style.border="1px solid #dbdbdb";
    zx.style.color="black";
    hd.style.color="red";
    hd.style.border="1px solid red";
}
function st(){
    var st=document.getElementById("st");
    var sf=document.getElementById("sf");
    var ems=document.getElementById("ems");
    st.style.color="red";
    st.style.border="1px solid red";
    sf.style.border="1px solid #dbdbdb";
    sf.style.color="black";
    ems.style.border="1px solid #dbdbdb";
    ems.style.color="black";
}
function sf(){
    var st=document.getElementById("st");
    var sf=document.getElementById("sf");
    var ems=document.getElementById("ems");
    sf.style.color="red";
    sf.style.border="1px solid red";
    st.style.border="1px solid #dbdbdb";
    st.style.color="black";
    ems.style.border="1px solid #dbdbdb";
    ems.style.color="black";
}
function ems(){
    var st=document.getElementById("st");
    var sf=document.getElementById("sf");
    var ems=document.getElementById("ems");
    ems.style.color="red";
    ems.style.border="1px solid red";
    st.style.border="1px solid #dbdbdb";
    st.style.color="black";
    sf.style.border="1px solid #dbdbdb";
    sf.style.color="black";
}
